Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SamUtils PairOrientation is confusingly ambiguous about paired reads needing to map to the same contig #1709

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

yfarjoun
Copy link
Contributor

@yfarjoun yfarjoun commented May 15, 2024

  • Improved documentation to clarify that PairOrientation (in SamUtils) pertains only to reads on the same contig.
  • Now getPairOrientation will throw an exception if thrown when the two reads are mapped to different contigs
  • Added tests to verify that the exception is thrown in the 4 cases specified.

Description

Please explain the changes you made here.
Explain the motivation for making this change. What existing problem does the pull request solve?

Things to think about before submitting:

  • Make sure your changes compile and new tests pass locally.
  • Add new tests or update existing ones:
    • A bug fix should include a test that previously would have failed and passes now.
    • New features should come with new tests that exercise and validate the new functionality.
  • Extended the README / documentation, if necessary
  • Check your code style.
  • Write a clear commit title and message
    • The commit message should describe what changed and is targeted at htsjdk developers
    • Breaking changes should be mentioned in the commit message.

…) pertains only to reads on the same contig.

- Now getPairOrientation will throw an exception if thrown when the two reads are mapped to different contigs
- Added tests to verify that the exception is thrown in the 4 cases specified.
Copy link
Member

@lbergelson lbergelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yfarjoun There's a typo. This seems like a good improvement otherwise though. Does this require corresponding changes in Picard to avoid hitting the new error case?

An alternate solution would be to add a new state that captures cross chromosome pairs.

* @return PairOrientation of the given SAMRecord.
* @throws IllegalArgumentException If the record is not a paired read, or
* one or both reads are unmapped.
* one or both reads are unmapped, or is the two records do are not mapped to the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here: "or is the two records do are not"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. fixed.

@yfarjoun
Copy link
Contributor Author

@lbergelson I don't think that it should be called with reads from different chromosomes. if is it, there's no meaning to RF,FR or TANDEM and so an exception seems (to me) to be the fastest way to find any problems. keeping it in a fourth meaningless state will either

  1. be a silent error (if that state isnt' checked)
  2. explode in a different place due to failing expectations...

it would be good to see if picard builds (and tests pass) with this version of htsjdk.... want to hlep me with that?

lbergelson added a commit to broadinstitute/picard that referenced this pull request Dec 12, 2024
@lbergelson lbergelson merged commit 9fe9042 into master Dec 12, 2024
4 checks passed
@lbergelson lbergelson deleted the yf_add_documentation_and_assert_orientatin branch December 12, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants